<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<h:form rendered="#{currentUser.teacher}" >
	<h:panelGrid columns="3" columnClasses="labelText, normalText, errorMsg" >
		<h:outputText value="Imie i nazwisko" />
		<h:inputText value="#{studentBean.student.name}" id="nazwisko" required="true">
			<f:validateLength minimum="3" maximum="40"/>
		</h:inputText> 
		<h:message for="nazwisko" styleClass="errorMsg" />
		
		<h:outputText value="Nr indeksu" />
		<h:inputText value="#{studentBean.student.indexNumber}" id="indeks" required="true">
			<f:validateLength minimum="6" maximum="6"/>
		</h:inputText>
		<h:message for="indeks" styleClass="errorMsg" />
		
		<h:outputText value="Adres e-mail" />
		<h:inputText value="#{studentBean.student.email}" id="mail" required="true">
			<f:validator validatorId="iosr11.ui.validators.Email" />
		</h:inputText>
		<h:message for="mail" styleClass="errorMsg" />
		
	</h:panelGrid>
	<h:messages styleClass="errorMsg" />
	<h:commandButton value="Dodaj" action="#{studentBean.addStudent}" rendered="#{not studentBean.editMode}" />
	<h:commandButton value="Zapisz" action="#{studentBean.updateStudent}" rendered="#{studentBean.editMode}" />
	<h:commandButton value="Usun" action="#{studentBean.delete}"  rendered="#{studentBean.editMode}" />
	<h:commandButton value="Powrot" action="nav_student_list" immediate="true" />
</h:form>